import request from '@/api/request.js';

//根据用户名获取用户信息
export function getUserByUsername(username) {
  return request({
    url: '/getUserByUsername',
    method: 'get',
    params: {
      username,
    },
  });
}

//获取所有用户信息
export function getAllUser() {
  return request({
    url: '/getAll',
    method: 'get',
  });
}

//根据搜索关键字进行模糊查询
export function searchUserLike(keyword) {
  return request({
    url: '/searchUserLike',
    method: 'get',
    params: {
      keyword,
    },
  });
}

//新增交通部门用户
export function addTrafficUser(data) {
  return request({
    url: '/userManage/addTrafficUser',
    method: 'post',
    data,
  });
}

//修改用户信息,put请求
export function updateUser(data) {
  return request({
    url: '/userManage/update',
    method: 'put',
    data,
  });
}

//根据用户名删除用户
export function deleteUserByUsername(username) {
  return request({
    url: '/userManage/cancel',
    method: 'delete',
    data: {
      username,
    },
  });
}
